public class AnonymousInnerClassExample {
    public void doSomething() {
        int localVar = 42; // 局部变量

        // 创建匿名内部类
        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                System.out.println("Inside anonymous inner class: " + localVar);
            }
        };

        // localVar = 100; // 修改局部变量的值

        // 调用匿名内部类的run方法
        runnable.run();
    }

    public static void main(String[] args) {
        AnonymousInnerClassExample example = new AnonymousInnerClassExample();
        example.doSomething();
    }
}